//创建突击队 传入位置
params ["_type", "_pos2", ["_control", false]];

private ["_roads", "_group", "_veh", "_level", "_unit"];

/*
if(_dis == 0) then
{
	_pos2 = [_pos] call fn_getPosNearLocal;
}
else
{
	_pos2 = [_pos, _dis, 250] call fn_getPosNearLand;
};
*/
//////////////////////////////////////

_group = createGroup (_type select 0);


if((_type select 2) isKindOf "Air") then
{
	_veh = createVehicle [(_type select 2), _pos2 , [], 100, "FLY"];
	_veh engineOn true;
}else
{
	//_____________________________清障碍物_____________________________
	[_pos2, 10] call fn_cleanupTerrain;
	_veh = createVehicle [(_type select 2), _pos2 , [], 0, "NONE"];
	//_veh engineOn true;
	
	//迷彩
	_veh call fn_randomMask;
};


_level = (_type select 1);

{
	if(_forEachIndex > 2) then
	{
		_unit = [(_type select _forEachIndex), _pos2, _level, _group] call fn_createUnit;
		if(isNull driver _veh) then
		{
			_unit moveInDriver _veh;
		};
		if(isNull commander _veh) then
		{
			_unit moveInCommander _veh;
		};
		if(isNull gunner _veh) then
		{
			_unit moveInGunner _veh;
		};
		
		
		
		if((vehicle _unit) == _unit) then
		{
			//其他movein 不返回bool值，真坑爹
			if !(_unit moveInAny _veh) then
			{
				_unit setDamage [1, false];
			};
		};
		
	};
}forEach _type;


if(Param_Debug == 1) then
{
	_group addGroupIcon ["b_hq",[0,0]];
	_group setGroupIconParams [[1,0,0,1],"突击队",1,true];
};

//_group enableDynamicSimulation true;
//_veh enableDynamicSimulation true;

//
[_group, _veh, _control] spawn fn_controlG;

_group

